﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Ex04.Menus.Test
{
    using Ex04.Menus.Delegates;

    public static class DelegateTester
    {
        public static void DemonstrateDelegatesMenu()
        {
            Delegates.MainMenu mainMenu = buildDelegatesMenu();
            mainMenu.Show();
        }

        private static Menus.Delegates.MainMenu buildDelegatesMenu()
        {
            MainMenu mainMenu = new MainMenu();
            mainMenu.MainItemsCollection.Title = "*** Main Menu - Delegates ***";

            mainMenu.Add(
                new SubMenu("Amazing ASCII art - Sub menu")
                .Add(new ActionItem("Birthday", new Examples.HappyBirthday().DoIt))
                .Add(new ActionItem("Paradox", new Examples.Paradox().DoIt))
                .Add(new ActionItem("Monkey", new Examples.Monkey().DoIt)));

            mainMenu.Add(new ActionItem("Calculate Factorial", new Examples.Factorial().DoIt));

            mainMenu.Add(
                new SubMenu("Math Functions")
                .Add(new SubMenu("Trigonometric functions")
                    .Add(new ActionItem("Sin(x)", new Examples.Sin().DoIt))
                    .Add(new ActionItem("Cos(x)", new Examples.Cos().DoIt)))
                .Add(new ActionItem("x^0.5", new Examples.SquareRoot().DoIt)));

            mainMenu.Add(new ActionItem("Factorial second edition", new Examples.Factorial().DoIt));

            return mainMenu;
        }
    }
}
